package com.service;



import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.session.SqlSession;

import com.dao.ArchiveDao;
import com.pojo.Archive;
import com.util.sqlSessionFactory;

public class ArchiveService {
     SqlSession sql = sqlSessionFactory.getSqlSession();
     ArchiveDao dao = sql.getMapper(ArchiveDao.class);
     public void addDA(
    	   @Param("archive_id")String archive_id,
  		   @Param("identity")String identity,
  		   @Param("name")String name,
  		   @Param("gender")String gender,
  		   @Param("birthday")String birthday,
  		   @Param("date_retire1")String date_retire1,
  		   @Param("date_retire2")String date_retire2,
  		   @Param("sp")String sp,
  		   @Param("fc")String fc,
  		   @Param("title")String title,
  		   @Param("seniority")String seniority
    		 ){
		 dao.addDA(archive_id, identity, name, 
				gender, birthday, date_retire1, date_retire2,
				sp, fc, title, seniority);
    	 sql.commit();
     }
  public List<Archive> chaxun(@Param("shuru")String shuru){return dao.chaxun(shuru);}
  
  public Archive one(@Param("id")String id){return dao.one(id);}

  
  public void update(
		   @Param("id") String id,
		   @Param("archive_id")String archive_id,
		   @Param("identity")String identity,
		   @Param("name")String name,
		   @Param("gender")String gender,
		   @Param("birthday")String birthday,
		   @Param("date_retire1")String date_retire1,
		   @Param("date_retire2")String date_retire2,
		   @Param("sp")String sp,
		   @Param("fc")String fc,
		   @Param("title")String title,
		   @Param("seniority")String seniority
		  ){
	    dao.update(id,archive_id, identity, name, gender, birthday, date_retire1, date_retire2, sp, fc, title, seniority);
	    sql.commit();
  }
  public void file(@Param("archive_id")String archive_id, 
		                 @Param("name") String name){
	  dao.file(archive_id, name);
	  sql.commit();
  }
  public Map<String, Object> lastId(){return dao.lastId();}
}
